package com.atchangsha.system.dto;


import com.atchangsha.system.entity.DiscountRulesEntity;
import lombok.*;

import java.io.Serializable;

@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class DiscountRulesDTO implements Serializable {
    /**
     * 主键
     */
    private Long id;
    /**
     * 会员等级
     */
    private String levelName;
    /**
     * 打几折
     */
    private Float discount;
    /**
     * 等级划分值
     */
    private Long point;
    /**
     * 将DTO转换成entity
     *
     * @return entity实体
     */
    public DiscountRulesEntity toEntity() {
        return DiscountRulesEntity.builder()
                .id(id)
                .levelName(levelName)
                .discount(discount)
                .point(point)
                .build();
    }
}
